<script>
$(function() {
	$( "#tabs" ).tabs({
	    select: function(event, ui) {
	        var url = $.data(ui.tab, 'load.tabs');
	        if( url ) {
	            location.href = url;
	            return false;
	        }
	        return true;
	    },
	selected: 0
	});
});
</script>
<div id="tabs">
	<ul>
    <li><a href='#accordion'>Chức vụ sinh viên</a> </li>
    <li><?php echo $this->Html->link(__('Chức vụ cán bộ', true), array('controller'=>'z1chucvucbs','action' => 'index')); ?></li>
	</ul>
<script>
	$(function() {
		$( "#accordion" ).accordion();
	});
	</script>
<div id="accordion">
<h3><a href="#">Danh sách chức vụ</a></h3>
<?php if($isAjax ==0){?>
<div>
	<h2><?php __('Danh sách chức vụ của sinh viên khoa '.$tenkhoa[0] ['khoas'] ['tenkhoa']);?></h2>
    <?php
    echo $form->create('Z1chucvusvs');
    echo $form->input('chucvu',array('id'=>'chucvu','label'=>'Chức vụ','options'=>$chucvu,'empty'=>"-- Chọn tất cả --",'selected'=>$chucv_id));
    echo $form->end();
    ?>
<div id="z1chucvusv">
    <p>
	<?php
	echo $this->Paginator->counter(array(
	'format' => __('Trang %page%/%pages%, hiện có %count% mẫu tin', true)
	));
	?>	</p>
	<table cellpadding="0" cellspacing="0" id="tables">
	<tr>
			<th><?php echo 'STT';?></th>
			<th><?php echo 'Chức vụ';?></th>
			<th><?php echo 'Họ tên';?></th>
			<th><?php echo 'Ngày bắt đầu';?></th>
			<th><?php echo 'Chi đoàn';?></th>
			<th class="actions"><?php __('Lựa chọn');?></th>
	</tr>
	<?php
	$i = 0;
	foreach ($z1chucvusvs as $z1chucvusv):
		$class = null;
		if ($i++ % 2 == 0) {
			$class = ' class="altrow"';
		}
	?>
	<tr<?php echo $class;?>>
		<td><?php echo $i; ?>&nbsp;</td>
		<td>
			<?php echo $z1chucvusv['Chucv']['tenchucvu']; ?>
		</td>
		<td>
			<?php echo $z1chucvusv['Sinhvien']['hoten']; ?>
		</td>
		<td><?php echo $z1chucvusv['Z1chucvusv']['ngaybatdau']; ?>&nbsp;</td>
		<td>
			<?php echo $z1chucvusv['Chidoansv']['tenchidoan']; ?>
		</td>
		<td class="actions">
			<?php echo $this->Html->link(__('Xóa', true), array('controller'=>'chucvusvs','action' => 'delete', $z1chucvusv['Z1chucvusv']['id']), null, sprintf(__('Bạn muốn xóa thông tin này?', true), $z1chucvusv['Z1chucvusv']['id'])); ?>
		</td>
	</tr>
<?php endforeach; ?>
	</table>

	<div class="paging">
		<?php echo $this->Paginator->prev('<< ' . __('Trước', true), array(), null, array('class'=>'disabled'));?>
	 | 	<?php echo $this->Paginator->numbers();?>
 |
		<?php echo $this->Paginator->next(__('Sau', true) . ' >>', array(), null, array('class' => 'disabled'));?>
	</div>
</div>
<?php } else{ if(!empty($z1chucvusvs)){ ?>
        <p>
	<?php
	echo $this->Paginator->counter(array(
	'format' => __('Trang %page%/%pages%, hiện có %count% mẫu tin', true)
	));
	?>	</p>
	<table cellpadding="0" cellspacing="0" id="tables">
	<tr>
			<th><?php echo 'STT';?></th>
			<th><?php echo 'Chức vụ';?></th>
			<th><?php echo 'Họ tên';?></th>
			<th><?php echo 'Ngày bắt đầu';?></th>
			<th><?php echo 'Chi đoàn';?></th>
			<th class="actions"><?php __('Lựa chọn');?></th>
	</tr>
	<?php
	$i = 0;
	foreach ($z1chucvusvs as $z1chucvusv):
		$class = null;
		if ($i++ % 2 == 0) {
			$class = ' class="altrow"';
		}
	?>
	<tr<?php echo $class;?>>
		<td><?php echo $z1chucvusv['Z1chucvusv']['id']; ?>&nbsp;</td>
		<td>
			<?php echo $z1chucvusv['Chucv']['tenchucvu']; ?>
		</td>
		<td>
			<?php echo $z1chucvusv['Sinhvien']['hoten']; ?>
		</td>
		<td><?php echo $z1chucvusv['Z1chucvusv']['ngaybatdau']; ?>&nbsp;</td>
		<td>
			<?php echo $z1chucvusv['Chidoansv']['id']; ?>
		</td>
		<td class="actions">
			<?php echo $this->Html->link(__('Sửa', true), array('action' => 'edit', $z1chucvusv['Z1chucvusv']['id'])); ?>
			<?php echo $this->Html->link(__('Xóa', true), array('action' => 'delete', $z1chucvusv['Z1chucvusv']['id']), null, sprintf(__('Are you sure you want to delete # %s?', true), $z1chucvusv['Z1chucvusv']['id'])); ?>
		</td>
	</tr>
<?php endforeach; ?>
	</table>

	<div class="paging">
		<?php echo $this->Paginator->prev('<< ' . __('Trước', true), array(), null, array('class'=>'disabled'));?>
	 | 	<?php echo $this->Paginator->numbers();?>
 |
		<?php echo $this->Paginator->next(__('Sau', true) . ' >>', array(), null, array('class' => 'disabled'));?>
	</div>
<?php } else echo 'Không có dữ liệu' ?>
<?php } ?>
</div>
<?php
$this->Js->get('#chucvu')->event('change',
							$this->Js->request(array('controller' => 'Z1chucvusvs', 'action' => 'index',$chucv_id),
							array('update' => '#z1chucvusv','async' => true,
							'dataExpression' => true,'method' => 'post',
							'data' => $js->serializeForm(array('isForm' => false, 'inline' => true)))));
?>
<h3><a href="#">Thêm chức vụ cho sinh viên</a></h3>
<div>
    <fieldset>
        	<legend><?php __('Thêm chức vụ cho sinh viên'); ?></legend>
            <?php
                    echo $form->create('Them',array('url'=>'luu'));
                    echo $form->input('chucvu',array('id'=>'chucvu','label'=>'Chức vụ','options'=>$chucvu,'empty'=>"-- Chọn chức vụ --",'selected'=>$chucv_id));
                    echo $form->input('khoahoc',array('id'=>'khoahoc','label'=>'Khóa học','options'=>$khoahoc,'empty'=>"-- Chọn khóa học --",'selected'=>$khoahoc_id));
                    echo '<div id="chidoan">';
                    echo $form->input('chidoan',array('id'=>'chidoan','label'=>'Chi đoàn','options'=>$chidoan,'empty'=>"------",'selected'=>$chidoan_id));
                    echo '</div>';
                    echo '<div id="sinhvien">';
                    echo '</div>';
                    echo $form->end('Thêm mới');
            ?>
    </fieldset>
</div>
<?php
$this->Js->get('#khoahoc')->event('change',
							$this->Js->request(array('controller' => 'Z1chucvusvs', 'action' => 'laycd'),
							array('update' => '#chidoan','async' => true,
							'dataExpression' => true,'method' => 'post',
							'data' => $js->serializeForm(array('isForm' => false, 'inline' => true)))));
$this->Js->get('#chidoan')->event('change',
							$this->Js->request(array('controller' => 'Z1chucvusvs', 'action' => 'laysv'),
							array('update' => '#sinhvien','async' => true,
							'dataExpression' => true,'method' => 'post',
							'data' => $js->serializeForm(array('isForm' => false, 'inline' => true)))));
?>
</div>
</div>